package com.dyh.quickdemo.conf;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/*
@Author=Joey Wheeler
@Date=2021/4/19 18:21
*/
@SpringBootTest
public class TestarrPropTest {

//    @Autowired
//    TestarrProp testarrProp;

    @Value("${hh}")
    private String hh;



    @Test
    public void test1(){
        System.out.println();
        String str = "topic_order_back_stubbing_test2\t";
        System.out.println(str);
        System.out.println(str.replaceAll("\t",""));
    }

    public static String replaceBlank(String str) {
        String dest = "";
        if (str != null) {
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }

    @Test
    public void test(){
        ApplicationContext applicationContext =
                new FileSystemXmlApplicationContext("classpath:spring-context.xml");

        TestarrConf testarrConf = applicationContext.getBean(TestarrConf.class);
        System.out.println();
        //        String str = "topic_order_back_stubbing_test2\\t\\t\\t";
//
//        System.out.println(str.trim());
//        System.out.println(StringUtils.trimTrailingWhitespace(str));
//
//        System.out.println();
    }
}
